<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>商户迁移</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
   <link rel="stylesheet" href="../../../bangnuo/admin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="../../../bangnuo/admin/style/admin.css" media="all">
</head>
<body>

<div class="layui-fluid">
  <div class="layui-card">
    <div class="layui-form layui-card-header layuiadmin-card-header-auto">
      <div class="layui-form-item">
        <div class="layui-inline">
          <label class="layui-form-label">迁移编号</label>
          <div class="layui-input-block">
            <input type="text" name="number" placeholder="请输入" autocomplete="off"
                   class="layui-input">
          </div>
        </div>

        <div class="layui-inline">
          <label class="layui-form-label">商家名称</label>
          <div class="layui-input-block">
            <input type="text" name="commercialTenantName" placeholder="请输入" autocomplete="off"
                   class="layui-input">
          </div>
        </div>

        <div class="layui-inline">
          <button class="layui-btn layuiadmin-btn-useradmin" lay-submit lay-filter="LAY-user-front-search">
            <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
          </button>
        </div>
      </div>
    </div>
    <div class="layui-card-body">
      <table id="merchants-demo" lay-filter="merchants-demo" ></table>
    </div>
  </div>
</div>

  <script src="../../../bangnuo/admin/layui/layui.js"></script>  

<script>
    layui.use(['util', 'table', 'form'], function () {
        var table = layui.table,
            form = layui.form;
        form.on('submit(LAY-user-front-search)', function (data) {
            var merchantsEntity = {
                //"merchantsNumber": data.field.merchantsNumber,
                "number": data.field.number,
                "commercialTenantName": data.field.commercialTenantName,
            }
            table.reload('merchants-overloading', {
                url: '/commercialMigration/findList/1/5',
                where: merchantsEntity,
                page: {
                    curr: 1
                }
            });
            return false;
        });
        //第一个实例
        table.render({
            elem: '#merchants-demo',
            method: "post",
            toolbar: '#toolbarDemo', //开启头部工具栏，并为其绑定左侧模板
            contentType: "application/json;charset=UTF-8",
            url: '/commercialMigration/findList/1/5', //数据接口
            page: true, //开启分页
            parseData: function (res) { //res 即为原始返回的数据
                console.log("res执行", res);
                return {
                    "code": 0, //解析接口状态
                    "msg": "", //解析提示文本
                    "count": res.queryResult.total, //解析数据长度
                    "data": res.queryResult.list//解析数据列表
                };
            },
            limit: 5,
            id: "merchants-overloading",
            limits: [5, 10, 20, 50, 100],
            request: {
                pageName: 'page' //页码的参数名称，默认：page
                ,limitName: 'size' //每页数据量的参数名，默认：limit
            },
            cols: [
                [ //表头
                    {
                        field: 'number',
                        title: '迁移编号',
                        width: 300,
                        sort: true,
                        fixed: 'left'
                    }, {
                    field: 'commercialTenantName',
                    title: '商家名称',
                    width: 150
                },{
                    field: 'oldAgentName',
                    title: '原代理商名称',
                    width:300
                }, {
                    field: 'newAgentName',
                    title: '新代理商名称',
                    width: 300
                }, {
                    field: 'createTime',
                    title: '创建时间',
                    templet: '<div>{{ layui.util.toDateString(d.createTime, "yyyy-MM-dd HH:mm:ss") }}</div>'
                }
                ]
            ]
        });

    });
</script>
</body>
</html>
